package kr.hkit.powerjava.chther10;

import java.util.Random;

public class LottoGenerater {
	private int[] arr;
	private static final int SIZE =6;
	private Random rnd;
	
	public LottoGenerater() {
		arr = new int[LottoGenerater.SIZE];
		rnd =new Random();
	}
	
	public void getLottoNum() {
		int num =-1;
		for (int i = 0; i < arr.length; i++) {
//			arr[i] = getNum();
			num =getNum();
			if(!isFind(num)){
//				arr[i]=num;
				num = getNum();
				i--;
			}else{
				num = getNum();
			}
			
			
		}
	}
	public int getNum() {
		return rnd.nextInt(45)+1;
	}
	
	public boolean isFind(int searchNum) {
		boolean isEquals =false;
		for (int i = 0; i < arr.length; i++) {
			if(searchNum == arr[i]){
				isEquals = true;
				break;
			}
		}
		return isEquals;
	}
	
//	@Override
//	public String toString() {
//		return arr;
//	}

	public static void main(String[] args) {
		LottoGenerater lo = new LottoGenerater();
		lo.getLottoNum();
	
		System.out.println(lo);
//		String result = lo.isFind(30)?"Find":"Not Fount";
	}
}
